import yfinance as yf

# 定义期货代码，这里以原油期货为例
futures_symbol = 'CL=F'
# 定义数据的起始和结束日期
start_date = '2024-01-01'
end_date = '2024-12-31'

# 获取期货数据
data = yf.download(futures_symbol, start=start_date, end=end_date)
print(data)